<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>一级代理列表</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" type="text/css" href="css/main.css" />
  <link rel="stylesheet" type="text/css" href="../mobile/js/layer/css/layui.css" />
  <script src="../mobile/js/jquery-1.9.1.js"></script>
  <script src="../mobile/js/layer/layui.js"></script>
  <script src="./js/common.js"></script>
  <script type="text/javascript">
      //访问是否登录,ajax同步请求
      logins(); 
  </script>
</head>
<body>
<div style="margin: -30px 20px 20px 20px;">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
  <legend>一级代理列表</legend>
</fieldset>
<blockquote class="layui-elem-quote">
        <div class="layui-inline">
            <input class="layui-input" name="key" id="key" placeholder="请输入代理昵称">
        </div>&nbsp;
     <button class="layui-btn btns" id="search" data-type="reload"><i class="layui-icon" style="color: #fff">&#xe615;</i>搜索</button>
     <button class="layui-btn" onclick="window.location.href='agent_add.html'" style="background:#5FB878;"><i class="layui-icon" style="color: #fff">&#xe608;</i> 添加</button>

     <!-- <button class="layui-btn btns_del" id="delAll"><i class="layui-icon" style="color: #fff">&#xe640;</i>批量删除</button> -->
</blockquote>
<table class="layui-hide" id="list" lay-filter="list"></table>
</div>

<script type="text/html" id="action">
    <a href="daili_detail.html?daili_id={{d.id}}"   class="layui-btn layui-btn-normal layui-btn-xs">查看详情</a>
</script>
<script>
layui.use(['table','form'], function() {
      var table = layui.table,form = layui.form,$ = layui.jquery;
      var urls = url + "/admin/agency/sandailiList";
      var tableIn = table.render({
          elem: '#list',
          url: urls,
          method: 'post',
          page: true,
          where: {},
          cols: [[
              {checkbox:true,fixed: true},
              {field: 'id', title: '编号', fixed: true,width:100,align: 'center', },
              {field: 'agent_name', title: '代理昵称'},
              {field: 'mobile', title: '手机号'},
              {field: 'agent_qq', title: '账号'},
              {field: 'agent_level', title: '等级'},
              {field: 'idcard', title: '身份证'},
              {field: 'sex', title: '性别'},
              {field: 'addtime', title: '日期',width:200,align: 'center', },
            /*  {title: '启用状态',width:100, align: 'center', toolbar: '#status'},*/
              {title: '操作', width: 160, align: 'center', toolbar: '#action'}
          ]],
          limit: 10, //每页默认显示的数量
          done:function(msg){
             if (msg.codes == 0) {
                layer.alert(msg.infomsg,{time:1000,icon:5});
             }
          }
      });
       
      //搜索内容
      $('#search').on('click', function() {
            var key = $('#key').val();
            if($.trim(key)==='') {
                layer.msg('请输入关键字！',{icon:0});
                return;
            }
            tableIn.reload({
                where: {key: key}
            });
       });
});

</script>
</body>
</html>